package com.ruoyi.inventory.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.inventory.mapper.BizStockMapper;
import com.ruoyi.inventory.domain.BizStock;
import com.ruoyi.inventory.service.IBizStockService;
import com.ruoyi.common.core.text.Convert;

/**
 * 库存Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-16
 */
@Service
public class BizStockServiceImpl implements IBizStockService 
{
    @Autowired
    private BizStockMapper bizStockMapper;

    /**
     * 查询库存
     * 
     * @param stockId 库存主键
     * @return 库存
     */
    @Override
    public BizStock selectBizStockByStockId(Long stockId)
    {
        return bizStockMapper.selectBizStockByStockId(stockId);
    }

    /**
     * 查询库存列表
     * 
     * @param bizStock 库存
     * @return 库存
     */
    @Override
    public List<BizStock> selectBizStockList(BizStock bizStock)
    {
        return bizStockMapper.selectBizStockList(bizStock);
    }

    /**
     * 新增库存
     * 
     * @param bizStock 库存
     * @return 结果
     */
    @Override
    public int insertBizStock(BizStock bizStock)
    {
        bizStock.setCreateTime(DateUtils.getNowDate());
        return bizStockMapper.insertBizStock(bizStock);
    }

    /**
     * 修改库存
     * 
     * @param bizStock 库存
     * @return 结果
     */
    @Override
    public int updateBizStock(BizStock bizStock)
    {
        bizStock.setUpdateTime(DateUtils.getNowDate());
        return bizStockMapper.updateBizStock(bizStock);
    }

    /**
     * 批量删除库存
     * 
     * @param stockIds 需要删除的库存主键
     * @return 结果
     */
    @Override
    public int deleteBizStockByStockIds(String stockIds)
    {
        return bizStockMapper.deleteBizStockByStockIds(Convert.toStrArray(stockIds));
    }

    /**
     * 删除库存信息
     * 
     * @param stockId 库存主键
     * @return 结果
     */
    @Override
    public int deleteBizStockByStockId(Long stockId)
    {
        return bizStockMapper.deleteBizStockByStockId(stockId);
    }
}
